<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>excel导出</title>
<style>
    html,body{
        width: 99%;
        height: 99%;
        font-family: "微软雅黑";
        font-size: 12px;
    }
    #tables{
        width: 100%;
        text-align: center;
        border: 1px #000 solid;
        border-collapse: collapse;
    }
    #tables th,#tables td{
        border: 1px solid #000000;
    }
    #tables th{
        font-size: 14px;
        font-weight: bolder;
    }
</style>

</head>
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="tableExport.js"></script>
<script type="text/javascript" src="base64.js"></script>
<body>
    <table id="tables">
        <thead>
        <tr>
            <th>姓名</th>
            <th>性别</th>
            <th>年龄</th>
            <th>地址</th>
        </thead>
        <tbody>
        <tr>
            <td>张三</td>
            <td>男</td>
            <td>34</td>
            <td>湖北省武汉市</td>
        </tr>
        <tr>
            <td>张三</td>
            <td>男</td>
            <td>34</td>
            <td>湖北省武汉市</td>
        </tr>
        </tbody>
    </table>
    
    <input type="button" id="export" value="导出"/>
</body>
<script>
    $(document).ready(function(){
        $("#export").click(function(){
            //导出
            $("#tables").tableExport({type:"excel",escape:"false"});
        });
    });
</script>
</html>